package com.test.test.mq;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
@Slf4j
@RequiredArgsConstructor
public class MQController {

    @Autowired
    private Producer messageSender;

    @GetMapping("/send-message")
    public String sendMessage(@RequestParam String message) {
        messageSender.sendMessage(message);
        return "Message sent: " + message;
    }
}
